package com.kscrm.web.controller.web;

import java.util.List;

import com.kscrm.web.domain.ChannelContact;
import com.kscrm.web.service.IChannelContactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.kscrm.common.annotation.Log;
import com.kscrm.common.core.controller.BaseController;
import com.kscrm.common.core.domain.AjaxResult;
import com.kscrm.common.enums.BusinessType;
import com.kscrm.common.core.page.TableDataInfo;

/**
 * 渠道联系人Controller
 *
 * @author Dhq
 * @date 2025-02-14
 */
@RestController
@RequestMapping("/web/channelContact")
public class ChannelContactController extends BaseController {
    @Autowired
    private IChannelContactService channelContactService;
    
    /**
     * 获取渠道联系人详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(channelContactService.selectChannelContactById(id));
    }

    /**
     * 新增渠道联系人
     */
    @Log(title = "渠道联系人", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ChannelContact channelContact) {
        return toAjax(channelContactService.insertChannelContact(channelContact));
    }

    /**
     * 修改渠道联系人
     */
    @Log(title = "渠道联系人", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ChannelContact channelContact) {
        return toAjax(channelContactService.updateChannelContact(channelContact));
    }

    /**
     * 删除渠道联系人
     */
    @Log(title = "渠道联系人", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(channelContactService.deleteChannelContactByIds(ids));
    }
}
